package smartwiz.client.app.mvp.admin;

import smartwiz.client.BudvaServiceAsync;
import smartwiz.client.app.Application;
import smartwiz.client.fwk.ActivityRegistry;
import smartwiz.client.fwk.BaseMVP;
import smartwiz.client.fwk.Place;

import com.google.inject.Inject;

public class AdminMVP extends BaseMVP {
	
	public static final String ACTIVITY_ID = "admin";
	
	public static final Place place() {
		return new Place(Application.WORKSPACE_CONTAINER_ID, ACTIVITY_ID);
	}
	
	public static interface View extends BaseMVP.View<Presenter> {
	}
	
	public static interface Presenter extends BaseMVP.Presenter<View> {

	}
	
	private AdminView view;

	@Inject
	public AdminMVP(ActivityRegistry registry, final BudvaServiceAsync service) {
		super(registry);
		mapPlaces(place()).to(new Factory<Presenter>() {
			public Presenter create(Place place) {
				if(view == null) {
					view = new AdminView();
				}
				return new AdminPresenter(place, view, service); 
			}
		});
	}
}
